/**
 * @type {String}
 *
 * @properties={typeid:35,uuid:"A931DAE0-1164-4C79-8B9E-5914D5A6AA93"}
 */
var fPass = null;

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"F8CDABC7-A61B-4EE4-9449-503E916EEC71"}
 */
function guardar(event) {
	if (fPass != null)
	{
		hash_password = utils.stringMD5HashBase64(fPass)
		fPass = null
	}
	if (databaseManager.saveData())
		globals.DIALOGS.showInfoDialog('Aviso','Usuario guardado exitosamente','OK')
	else
		globals.DIALOGS.showWarningDialog('Aviso','Ocurrió un error al grabar','OK')
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"FC8C29D2-3128-4E98-B9E8-5EEF9E5394EE"}
 */
function eliminar(event) {
	uservs_to_soluciones_x_uservs.deleteRecord()
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"1C27D571-2C27-4933-823B-6703B992B24F"}
 */
function agregar(event) {
	uservs_to_soluciones_x_uservs.newRecord()
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"83F9402D-47BD-45C5-896F-1F12C99094B1"}
 */
function nuevo(event) {
	controller.newRecord()
}

/**
 * Callback method for when form is shown.
 *
 * @param {Boolean} firstShow form is shown first time after load
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"5298320B-B8E1-4486-9B35-DA81F20B4796"}
 */
function onShow(firstShow, event) {
	databaseManager.setAutoSave(false)
}

/**
 * Handle hide window.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @returns {Boolean}
 *
 * @properties={typeid:24,uuid:"EAD96D43-345F-4BCE-A065-F35CB6BB3695"}
 */
function onHide(event) {
	databaseManager.revertEditedRecords()
	databaseManager.setAutoSave(true)
	return true
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"2DEDA1B4-51D2-4FAB-8D4C-4C14966152B2"}
 */
function volver(event) {
	forms.uservs_tbl.controller.show()
}
